import React, { Component } from 'react';

//加载模块样式
import { Selectstate_style as styles } from '../../../../styles';

import {
    View,
    Text,
    TouchableOpacity,
    ScrollView,
} from 'react-native';
var Dimensions = require('Dimensions');
var width = Dimensions.get('window').width;          //获取屏幕宽度
import Particulars_c from './particulars_c';
import History_c from './history_c';

export default class Selectc_state extends Component {

    constructor(props) {
        super(props);
        this.state = {
            sel_state: 0,
        }
    }
    render() {
        return (
            <View style={[styles.sel_all2, { width: width * 1 }]}>
                <View style={styles.sel_out}>
                    <View style={[styles.sel_in, { width: width * 0.68 }]}>

                        <TouchableOpacity activeOpacity={1}
                            onPress={() => { this.setState({ sel_state: 0 }) }} style={styles.area}>
                            {this.state.sel_state == 0 ? <Text style={styles.onfocus}>历史记录</Text>
                                : <Text style={styles.unfocus}>历史记录</Text>}
                            {this.state.sel_state == 0 ? <View style={styles.sel_line} />
                                : <View style={styles.sel_line2} />}
                        </TouchableOpacity>

                        <TouchableOpacity activeOpacity={1}
                            onPress={() => { this.setState({ sel_state: 1 }) }} style={styles.area}>
                            {this.state.sel_state == 1 ? <Text style={styles.onfocus}>搜索条件</Text>
                                : <Text style={styles.unfocus}>搜索条件</Text>}
                            {this.state.sel_state == 1 ? <View style={styles.sel_line} /> : <View style={styles.sel_line2} />}
                        </TouchableOpacity>
                    </View>
                </View>

                <ScrollView>
                    {
                        this.state.sel_state == 0 ?
                            <History_c
                                _resumePosition={this.props._resumePosition.bind(this)}
                                _horstate={this.props._horstate.bind(this)}
                                dataSource={this.props.dataSource}
                                _deldataSource={this.props._deldataSource.bind(this)}
                                actions={this.props.actions}
                                navigation={this.props.navigation} />
                            :
                            <Particulars_c
                                _resumeIntentYm={this.props._resumeIntentYm.bind(this)}
                                _resumeMm={this.props._resumeMm.bind(this)}
                                _educationLevel={this.props._educationLevel.bind(this)}
                                _fieldName={this.props._fieldName.bind(this)}
                                navigation={this.props.navigation} />
                    }
                </ScrollView>

            </View >
        )
    }
}